#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main() {
    int a = 0;
   
    while(scanf("%d", &a) == 1)
    {
      
        for (int i = 1; i <= a; i++)
        {
            if ((1 == i) || (a == i))
            {
                
                for (int j = 1; j <= a; j++)
                {
                    printf("* ");
                }
            }
            else
            {
                if (i == 2)
                    printf("\n");
                for (int j = 2; j <= a - 1; j++)
                {
                    
                    printf("* ");
                    for (int k = 2; k <= a - 1; k++)
                    {
                        printf("  ");
                    }
                    break;
                }
                printf("* ");
                printf("\n");
            }

        }
        printf("\n");

       
    }
  
    return 0;
}